<?php

class openapi_api_params_v1_basicmaterial extends openapi_api_params_abstract implements openapi_api_params_interface{

    public function checkParams($method,$params,&$sub_msg){
        if(parent::checkParams($method,$params,$sub_msg)){
            return true;
        }else{
            return false;
        }
    }

    public function getAppParams($method){
        $params = array(
            'getList'=>array(
                'material_bn'   => array('type' => 'string','name' => '基础物料编码'),
               	'page_no'=>array('type'=>'number','require'=>'false','name'=>'页码','desc'=>'默认1,第一页'),
       			'page_size'=>array('type'=>'number','require'=>'false','name'=>'每页数量','desc'=>'最大100'),
            ),
            'add'=>array(
                'material_name'  => array('type'=>'string','required'=>'true','name'=>'基础物料名称','desc'=>'必填'),
                'material_bn'   => array('type' => 'string','required'=>'true','name' => '基础物料编号','desc'=>'必填'),
                'material_type'   => array('type' => 'number','required'=>'true','name' => '基础物料类型','desc' => '必填，1代表普通类型、2代表组合类型'),
                'serial_number'   => array('type' => 'string','name' => '是否启用唯一码','desc' => 'true 开启、false 关闭'),
                'visibled' => array('type' => 'number','required'=>'true','name' => '是否可售','desc'=>'必填，1代表可售、2代表停售'),
                'material_code' => array('type' => 'string','required'=>'true','name' => '条码','desc'=>'必填'),
                'unit'   => array('type' => 'string','name' => '计量单位'),
                'retail_price'   => array('type' => 'string','name' => '销售价'),
                'cost'   => array('type' => 'string','name' => '成本价'),
                'weight'   => array('type' => 'string','name' => '重量'),
                'bind_info'   => array('type' => 'string','name'=>'组合类物料信息','desc' => '例子：test001:1|test002:2'),
                'use_expire'   => array('type' => 'number','name' => '是否启用保质期监控','desc'=>'必填，1代表开启、2代表关闭'),
                'warn_day'   => array('type' => 'number','name' => '预警天数配置'),
                'quit_day'   => array('type' => 'number','name' => '自动退出库存天数配置'),
            ),
            'edit'=>array(
                'material_name'  => array('type'=>'string','required'=>'true','name'=>'基础物料名称','desc'=>'必填'),
                'material_bn'   => array('type' => 'string','required'=>'true','name' => '基础物料编号','desc'=>'必填'),
                'material_type'   => array('type' => 'number','required'=>'true','name' => '基础物料类型','desc'=>'必填，1代表普通类型、2代表组合类型'),
                'serial_number'   => array('type' => 'string','name' => '是否启用唯一码','desc' => 'true 开启、false 关闭'),
                'visibled' => array('type' => 'number','required'=>'true','name' => '是否可售','desc'=>'必填，1代表可售、2代表停售'),
                'unit'   => array('type' => 'string','name' => '计量单位'),
                'retail_price'   => array('type' => 'string','name' => '销售价'),
                'cost'   => array('type' => 'string','name' => '成本价'),
                'weight'   => array('type' => 'string','name' => '重量'),
                'bind_info'   => array('type' => 'string','name'=>'组合类物料信息','desc' => '例子：test001:1|test002:2'),
                'use_expire'   => array('type' => 'number','name' => '是否启用保质期监控','desc'=>'必填，1代表开启、2代表关闭'),
                'warn_day'   => array('type' => 'number','name' => '预警天数配置'),
                'quit_day'   => array('type' => 'number','name' => '自动退出库存天数配置'),
            ),
        );

        return $params[$method];
    }
    
    public function description($method){

        $desccription = array(
            'getList'=>array(
                'name'=>'基础物料查询接口',
                'description'=>'实时批量获取特定条件下的基础物料'
            ),
            'add'=>array(
                'name'        =>'基础物料添加接口',
                'description' =>'添加基础物料',
            ),
            'edit'=>array(
                'name'        =>'基础物料修改接口',
                'description' =>'修改基础物料',
            ),
        );

        return $desccription[$method];

    }
}